<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>页面设计</title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
  {include file="public/css"/}
</head>
<body>
  <div class="layui-fluid" style="padding:8px">
    <div class="layui-row layui-col-space15">
      <div class="layui-card layui-col-md12">
				<div class="layui-form">
				<div class="layui-card-header">
					{if $info['id']}<i class="fa fa-edit"></i> 页面编辑{else}<i class="fa fa-plus"></i> 添加页面{/if}
					<button class="layui-btn layui-btn-danger layui-btn-sm" onclick="pagesave(1)" style="float: right;margin-left:10px;margin-top: 6px;">设计完成</button>
					<button class="layui-btn layui-btn-primary layui-btn-sm" onclick="closeSelf()" style="float: right;margin-left:10px;margin-top: 6px;"><i class="fa fa-close"></i> 关闭</button>
					<button class="layui-btn layui-btn-primary layui-btn-sm" onclick="pagesave(0)" style="float: right;margin-top: 6px;"><i class="fa fa-save"></i> 保存</button>
				</div>
				<div class="layui-card-body">
						<input type="hidden" id="pageid" value="{$info['id']}">
						<!-- 详情编辑器 -->
						{include file="designer_page/designer" /}
						<!-- <div class="layui-form-item">
							<div class="layui-input-block" style="margin-left:400px">
								<button class="layui-btn layui-btn-danger" lay-submit lay-filter="formsubmit">设计完成</button>
							</div>
						</div> -->
				</div>
				</div>
			</div>
		</div>
  </div>
	<script>
	function closeSelf(){
		var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
		parent.layer.close(index); //再执行关闭   
	}
	function pagesave(savetype){
		var id = $('#pageid').val()
		var contentdata = geteditordata();
		var index = layer.load();
		$.post('',{ op:'save',id:id,content:contentdata.datainfo,pageinfo:contentdata.pageinfo},function(data){
			layer.close(index);
			if(data.status == 1 && savetype ==1){
				dialog(data.msg,data.status);
				setTimeout(function(){
					parent.layer.closeAll();
					parent.location.reload()
					//parent.tableIns.reload()
				},1000)
			}else{
				if(data.pageid){
					$('#pageid').val(data.pageid)
				}
				layer.msg(data.msg);
			}
		})
	}
  </script>
	{include file="public/copyright"/}
</body>
</html>